﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerControl : MonoBehaviour {

    private PlayerFSMSystem fsm;

    public void SetTransition(Transition t) { fsm.PerformTransition(t); }

    private void Start()
    {
        MakeFSM();
    }

    private void Update()
    {
        fsm.CurrentState.Reason(gameObject);
        fsm.CurrentState.Act(gameObject);
    }

    private void MakeFSM()
    {
        Player_IdleState player_IdleState = new Player_IdleState();
        player_IdleState.AddTransition(Transition.IsIdle, StateID.IdleState);
        Player_JumpState player_JumpState = new Player_JumpState();
        player_JumpState.AddTransition(Transition.IsJumpState, StateID.JumpState);
        Player_DieState player_DieState = new Player_DieState();
        player_DieState.AddTransition(Transition.IsDie, StateID.DieState);

        fsm = new PlayerFSMSystem();
        fsm.AddState(player_IdleState);
        fsm.AddState(player_JumpState);
        fsm.AddState(player_DieState);
    }

}
